package com.tuangou.tuangouorder.order.controller;

import com.atguigu.common.utils.PageUtils;
import com.atguigu.common.utils.R;
import com.tuangou.tuangouorder.order.entity.RecordUserEntity;
import com.tuangou.tuangouorder.order.service.RecordUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;

/**
 * 
 *
 * @author lsy
 * @email lsy@tuangou.com
 * @date 2021-06-18 20:36:33
 */
@RestController
@RequestMapping("order/recorduser")
public class RecordUserController {
    @Autowired
    private RecordUserService recordUserService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("order:recorduser:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = recordUserService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("order:recorduser:info")
    public R info(@PathVariable("id") Integer id){
		RecordUserEntity recordUser = recordUserService.getById(id);

        return R.ok().put("recordUser", recordUser);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("order:recorduser:save")
    public R save(@RequestBody RecordUserEntity recordUser){
		recordUserService.save(recordUser);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("order:recorduser:update")
    public R update(@RequestBody RecordUserEntity recordUser){
		recordUserService.updateById(recordUser);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("order:recorduser:delete")
    public R delete(@RequestBody Integer[] ids){
		recordUserService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
